package com.xiao.gulimall.search.conttollrt;

import com.xiao.common.utils.PageUtils;
import com.xiao.gulimall.search.service.EsService;
import com.xiao.gulimall.search.util.Search;
import com.xiao.gulimall.search.util.Searches;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/search")
public class EsController {
    @Autowired
    private EsService esService;

    @PostMapping("mohu")
    public PageUtils mohu(@RequestParam("size")Integer size,
                          @RequestParam("page")Integer page,
                          @RequestBody Search search){
       return esService.mohu(search,size,page);
    }

    @PostMapping("testes")
    public PageUtils testes(@RequestParam(value = "page",defaultValue = "1")Integer page,
                            @RequestParam(value = "size",defaultValue = "2")Integer size,
                            @RequestBody Searches searches){
        return  esService.testes(page,size,searches);
    }




}
